%%
%% This is file `CASthesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% CASthesis.dtx  (with options: `cls')
%%
%% This is a generated file.
%%
%% Copyright 2004-2006
%% CTEX.ORG and any individual authors listed elsewhere in this file.
%%
%% This file was generated from file(s) of the CASthesis package project.
%% ----------------------------------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% This file may only be distributed together with a copy of original
%% source files. You may however distribute original source files
%% without such generated files. Copying of this file is authorized
%% only if either:
%% (1) you make absolutely no changes to your copy, including name; OR
%% (2) if you do make changes, you first rename it to some other name.
%%
%% To produce the documentation run the original source files ending
%% with `.dtx' through LaTeX.
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{CASthesis}
  [2007/01/09 v0.1h CASthesis
   document class]
\newif\ifCAST@typeinfo \CAST@typeinfotrue
\DeclareOption{notypeinfo}{\CAST@typeinfofalse}
\newif\ifCAST@dvips \CAST@dvipstrue
\DeclareOption{dvips}{\CAST@dvipstrue}
\DeclareOption{dvipdfm}{\CAST@dvipsfalse}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions
\LoadClass[cs4size,a4paper,fancyhdr,fntef]{ctexbook}[2005/11/25]
%% math packages
\RequirePackage{amsmath,amsthm,amsfonts,amssymb,bm}
%% graphics packages
\RequirePackage{graphicx,psfrag}
%% check pdfTeX mode
\RequirePackage{ifpdf}
%% hyperref package
\ifpdf   % We're running pdfTeX in PDF mode
  \RequirePackage[pdftex]{hyperref}
\else    % We're not running pdfTeX, or running pdfTeX in DVI mode
  \ifCAST@dvips
    \RequirePackage[dvips]{hyperref}
  \else
    \RequirePackage[dvipdfm]{hyperref}
  \fi
  \AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}} % GBK -> Unicode
\fi
\hypersetup{CJKbookmarks,%
       bookmarksnumbered,%
              colorlinks,%
               linkcolor=blue,%
               citecolor=blue,%
              plainpages=false,%
            pdfstartview=FitH}
\AtEndOfPackage{\makeatletter\input{CASthesis.cfg}\makeatother}
\oddsidemargin 0.11 true cm
\if@twoside
  \evensidemargin 0.11 true cm
\else
  \evensidemargin 0.11 true cm
\fi
\textheight 22 true cm
\textwidth 15.8 true cm
\headheight 15pt
\topmargin 0.15 true cm
%\headsep 1.2 true cm
\parskip 0.5ex plus 0.15ex minus 0.15ex
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  \thispagestyle{empty}%
  \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\renewcommand{\floatpagefraction}{0.80}

\newcommand\CASTspace{\protect\CTEX@spaceChar\protect\CTEX@spaceChar}
\def\CAST@getfileinfo#1 #2 #3\relax#4\relax{%
  \def\CASTfiledate{#1}%
  \def\CASTfileversion{#2}%
  \def\CASTfileinfo{#3}}%
\expandafter\ifx\csname ver@CASthesis.cls\endcsname\relax
  \edef\reserved@a{\csname ver@ctextemp_CASthesis.cls\endcsname}
\else
  \edef\reserved@a{\csname ver@CASthesis.cls\endcsname}
\fi
\expandafter\CAST@getfileinfo\reserved@a\relax? ? \relax\relax
\def\CAST@underline[#1]#2{%
  \CTEXunderline{\hbox to #1{\hfill#2\hfill}}}
\def\CASTunderline{\@ifnextchar[\CAST@underline\CTEXunderline}
\newcommand\classification[1]{\def\CAST@value@classification{#1}}
\newcommand\confidential[1]{\def\CAST@value@confidential{#1}}
\newcommand\UDC[1]{\def\CAST@value@UDC{#1}}
\newcommand\serialnumber[1]{\def\CAST@value@serialnumber{#1}}
\newcommand\school[1]{\def\CAST@value@school{#1}}
\newcommand\degree[1]{\def\CAST@value@degree{#1}}
\renewcommand\title[2][\CAST@value@title]{%
  \def\CAST@value@title{#2}
  \def\CAST@value@titlemark{\MakeUppercase{#1}}}
\renewcommand\author[1]{\def\CAST@value@author{#1}}
\newcommand\advisor[1]{\def\CAST@value@advisor{#1}}
\newcommand\advisorinstitute[1]{\def\CAST@value@advisorinstitute{#1}}
\newcommand\major[1]{\def\CAST@value@major{#1}}
\newcommand\submitdate[1]{\def\CAST@value@submitdate{#1}}
\newcommand\defenddate[1]{\def\CAST@value@defenddate{#1}}
\newcommand\institute[1]{\def\CAST@value@institute{#1}}
\newcommand\chairman[1]{\def\CAST@value@chairman{#1}}
\renewcommand\maketitle{%
  \cleardoublepage
  \thispagestyle{empty}
  \begin{center}
    \bf\songti\zihao{-4}
      \CAST@label@classification~
      \CASTunderline[100pt]{\CAST@value@classification}
        \hfill
      \CAST@label@confidential~
      \CASTunderline[100pt]{\CAST@value@confidential}
    \vskip 10pt
      \CAST@label@UDC~
      \CASTunderline[108pt]{\CAST@value@UDC}
        \hfill
      \CAST@label@serialnumber~
      \CASTunderline[100pt]{\CAST@value@serialnumber}
    \vskip \stretch{2}
      \bf\songti\zihao{-1} \CAST@value@school \\
      \CAST@value@degree\CAST@label@thesis
    \vskip \stretch{2}
      \bf\heiti\zihao{3} \CASTunderline{~\CAST@value@title~}
    \vskip \stretch{1}
      \bf\songti\zihao{4} \CASTunderline{~\CAST@value@author~}
    \vskip \stretch{2}
    \bf\songti\zihao{4}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.5}
    \begin{tabular}{llcrl}
      \CAST@label@advisor &
      \multicolumn{4}{l}{\CASTunderline[299pt]{\CAST@value@advisor}}
    \\
      & \multicolumn{4}{l}{\CASTunderline[299pt]{\CAST@value@advisorinstitute}}
    \\
      \CAST@label@degree &
      \CASTunderline[80pt]{\CAST@value@degree} & &
      \CAST@label@major &
      \CASTunderline[150pt]{\CAST@value@major}
    \\
      \CAST@label@submitdate &
      \CASTunderline[80pt]{\CAST@value@submitdate} & &
      \CAST@label@defenddate &
      \CASTunderline[150pt]{\CAST@value@defenddate}
    \\
      \CAST@label@institute &
      \multicolumn{4}{l}{\CASTunderline[299pt]{\CAST@value@institute}}
    \\
      \CAST@label@school &
      \multicolumn{4}{l}{\CASTunderline[299pt]{\CAST@value@school}}
    \\[15pt]
      \multicolumn{4}{r}{\CAST@label@chairman} &
      \CASTunderline[100pt]{\CAST@value@chairman}
    \end{tabular}
  \end{center}
  \clearpage
  \if@twoside
    \thispagestyle{empty}
    \ifCAST@typeinfo
      \vspace*{\stretch{1}}
      \begin{footnotesize}
        \noindent
        Typeset by \LaTeXe{} at \CTEX@todayold \\
        With package \texttt{CASthesis} \CASTfileversion{} of C\TeX{}.ORG
      \end{footnotesize}
    \fi
    \cleardoublepage
  \fi
}
\newcommand\englishtitle[1]{\def\CAST@value@englishtitle{#1}}
\newcommand\englishauthor[1]{\def\CAST@value@englishauthor{#1}}
\newcommand\englishadvisor[1]{\def\CAST@value@englishadvisor{#1}}
\newcommand\englishinstitute[1]{\def\CAST@value@englishinstitute{#1}}
\newcommand\englishdate[1]{\def\CAST@value@englishdate{#1}}
\newcommand\englishdegree[1]{\def\CAST@value@englishdegree{#1}}
\newcommand\englishmajor[1]{\def\CAST@value@englishmajor{#1}}
\newcommand\makeenglishtitle{%
  \cleardoublepage
  \thispagestyle{empty}
  \begin{center}
    \vspace*{20pt}
      \bf\zihao{-1} \CAST@value@englishtitle
    \vskip \stretch{1}
      \bf\zihao{2} \CAST@value@englishauthor
    \vskip \stretch{1}
      \normalfont\zihao{3} \CAST@label@englishadvisor
    \vskip 3pt
      \normalfont\zihao{3} \CAST@value@englishadvisor
    \vskip \stretch{2}
      \normalfont\zihao{4} \CAST@value@englishinstitute
    \vskip 30pt
      \normalfont\normalsize \CAST@value@englishdate
    \end{center}
  \clearpage
  \if@twoside
    \thispagestyle{empty}
    \cleardoublepage
  \fi
}
\fancypagestyle{plain}{%
  \fancyhf{}%
%  \renewcommand{\headrulewidth}{0pt}%
%  \renewcommand{\footrulewidth}{0pt}%
%  \fancyfoot[RO]{\small ~\thepage~}
%}
  \fancyhead[CO]{\CJKfamily{kai}\small\CAST@value@titlemark}
  \fancyhead[CE]{\CJKfamily{kai}\small\leftmark}
  \fancyfoot[LE,RO]{\small ~\thepage~}
  \fancyfoot[CE,CO]{\CJKfamily{kai}\small\CAST@value@institute\CAST@value@degree\CAST@label@thesis}}
\pagestyle{fancy}
  \fancyhf{}%
  \fancyhead[CO]{\CJKfamily{kai}\small\CAST@value@titlemark}
  \fancyhead[CE]{\CJKfamily{kai}\small\leftmark}
  \fancyfoot[LE,RO]{\small ~\thepage~}
  \fancyfoot[CE,CO]{\CJKfamily{kai}\small\CAST@value@institute\CAST@value@degree\CAST@label@thesis}

\renewcommand\title[2][\CAST@value@title]{%
  \def\CAST@value@title{#2}
  \def\CAST@value@titlemark{#1}}
\def\chaptermark#1{\markboth {{\ifnum \c@secnumdepth>\m@ne
  \if@mainmatter\CTEXthechapter \quad\fi
  \fi #1}}{}}%
\def\sectionmark#1{\markright{{\ifnum \c@secnumdepth >\z@
  \CTEXthesection \quad \fi #1}}}

\newenvironment{abstract}
  {\Nchapter{\CAST@label@abstract}}
  {}
\newcommand\keywords[1]{%
  \vspace{2ex}\noindent{\heiti \CAST@label@keywords} #1}
\newenvironment{englishabstract}
  {\Nchapter{\CAST@label@englishabstract}}
  {}
\newcommand\englishkeywords[1]{%
  \vspace{2ex}\noindent{\bf \CAST@label@englishkeywords} #1}

\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \Nchapter{\contentsname}%
    \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }
%\addtocontents{toc}{\let\string\CTEX@spaceChar\relax}
\newcommand\Nchapter[1]{%
  \if@mainmatter%
    \@mainmatterfalse%
    \chapter{#1}%
    \@mainmattertrue%
  \else
    \chapter{#1}%
  \fi}
\renewenvironment{thebibliography}[1]
     {\Nchapter{\CAST@label@thebibliography}%
      \@mkboth{\MakeUppercase\CAST@label@reference}
              {\MakeUppercase\CAST@label@reference}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\newenvironment{publications}[1]
     {\Nchapter{\CAST@label@publications}%
      \@mkboth{\MakeUppercase\CAST@label@publications}
              {\MakeUppercase\CAST@label@publications}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `publications' environment}}%
      \endlist}
\newenvironment{resume}
  {\Nchapter{\CAST@label@resume}}
  {}
\newenvironment{resumesection}[1]
  {{\noindent\normalfont\bfseries #1}
   \list{}{\labelwidth\z@
           \leftmargin 2\ccwd}
   \item\relax}
  {\endlist}
\newenvironment{resumelist}[1]
  {{\noindent\normalfont\bfseries #1}
   \list{}{\labelwidth\z@
           \leftmargin 4\ccwd
           \itemindent -2\ccwd
           \listparindent\itemindent}
   \item\relax}
  {\endlist}
\renewenvironment{thanks}
  {\Nchapter{\CAST@label@thanks}}
  {}
\setcounter{secnumdepth}{4}
\newtheoremstyle{break}% name
  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {\newline}% Space after thm head: \newline = linebreak
  {}%         Thm head spec



%\newif\ifUCAS@versioninfo \UCAS@versioninfofalse
%\DeclareOption{draftversion}{% draft information reminder
%  \UCAS@versioninfotrue%
%}

\newcommand\schoollogo[2]{\def\CAST@value@schoollogo{\includegraphics[#1]{#2}}}
\newcommand\degreetype[1]{\def\CAST@value@degreetype{#1}}
\newcommand\chinesedate[1]{\def\CAST@value@chinesedate{#1}}


%%%%% --------------------------------------------------------------------------------
%%
%%%%**************************** make chinese titlepage ******************************
%%
\newcommand\xrqmaketitle{%
  \cleardoublepage
  \thispagestyle{empty}
  \begin{center}
    \heiti\zihao{4}
    \hfill{} {\CAST@label@confidential \CASTunderline[40pt]{\songti\zihao{5}\CAST@value@confidential}}
    \vskip \stretch{3}
      \CAST@value@schoollogo
    \vskip \stretch{4}
      {\heiti\zihao{1} \CAST@value@degree\CAST@label@thesis}
    \vskip \stretch{4}
      {\heiti\zihao{3} \CASTunderline{\ \CAST@value@title\ }}
    \vskip \stretch{6}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.4}
    %\hskip -15pt
    \begin{tabular}{lc}
      \CAST@label@author & \CASTunderline[295pt]{\CAST@value@author}
    \\
      \CAST@label@advisor & \CASTunderline[295pt]{\CAST@value@advisor}
    \\
      & \CASTunderline[295pt]{\CAST@value@advisorinstitute}
    \\
      \CAST@label@degree & \CASTunderline[295pt]{\CAST@value@degreetype\CAST@value@degree}
    \\
      \CAST@label@major &  \CASTunderline[295pt]{\CAST@value@major}
    \\
      \CAST@label@institute & \CASTunderline[295pt]{\CAST@value@institute}
    \end{tabular}
    \vskip \stretch{6}
    \CAST@value@chinesedate
  \end{center}
  \clearpage
  \if@twoside
    \thispagestyle{empty}
%    \ifUCAS@versioninfo
%      \vspace*{\stretch{1}}
%      \begin{footnotesize}
%        \noindent
%        Draft Version (\today)
%      \end{footnotesize}
%    \fi
    \cleardoublepage
  \else
%    \ifUCAS@versioninfo
%      \thispagestyle{empty}
%      \vspace*{\stretch{1}}
%      \begin{footnotesize}
%        \noindent
%        Draft Version (\today)
%      \end{footnotesize}
%      \cleardoublepage
%    \fi
  \fi
}
%%%%% --------------------------------------------------------------------------------
%%
%%%%*********************** make english titlepage ***********************************
%%
\newcommand\xrqmakeenglishtitle{%
  \cleardoublepage
  \thispagestyle{empty}
  \begin{center}
    \bfseries\zihao{3}
    \vspace*{20pt}
    {\CASTunderline{\ \CAST@value@englishtitle\ }}
    \vskip \stretch{1}
    By \\
    \CAST@value@englishauthor
    \vskip \stretch{2}
    \bfseries\zihao{4}
    \CAST@label@englishstatement
    \vskip 30pt
    \CAST@value@englishinstitute
    \vskip 20pt
    \CAST@value@englishdate
  \end{center}
  \clearpage
  \if@twoside
    \thispagestyle{empty}
    \cleardoublepage
  \fi
}
%%%%% --------------------------------------------------------------------------------
%%
%%%%*********************** make author declaration ***********************************
%%
\newcommand\makedeclaration{%
  \cleardoublepage
  \thispagestyle{empty}

  ~\\
  \vskip 40pt

  \begin{center}
      {\heiti\zihao{3} \CAST@value@declare@create}
  \end{center}

  \CAST@value@declare@creativity\\

  %\hfill{} {\UCAS@value@declare@s \UCASunderline[70pt]{ } \ \ \UCAS@value@declare@d \UCASunderline[70pt]{ }}\\
  {\hspace{1.5cm} \CAST@value@declare@s \CASTunderline[70pt]{ }  \hfill   \CAST@value@declare@d \CASTunderline[70pt]{ }   \hspace{1.5cm}} \\

  \vskip 100pt

  \begin{center}
      {\heiti\zihao{3} \CAST@value@declare@right}
  \end{center}

  \CAST@value@declare@rights

  %{\heiti \UCAS@value@declare@rule}\\

  %\hfill{} {\UCAS@value@declare@s \UCASunderline[70pt]{ } \ \ \UCAS@value@declare@t \UCASunderline[70pt]{ } \ \ \UCAS@value@declare@d \UCASunderline[70pt]{ }}
  {\hspace{1.5cm}  \CAST@value@declare@s \CASTunderline[70pt]{ } \hfill  \CAST@value@declare@t \CASTunderline[70pt]{ } \hspace{1.5cm}}  \\

  {\hspace{1.5cm}  \CAST@value@declare@d \CASTunderline[70pt]{ } \hfill  \CAST@value@declare@d \CASTunderline[70pt]{ } \hspace{1.5cm}}  \\

  %\clearpage
  %\if@twoside
  %  \thispagestyle{empty}
  %  \cleardoublepage
  %\fi
}
%%%%% --------------------------------------------------------------------------------

%\RequirePackage[square,comma,super,sort&compress]{natbib}  % super index

\endinput
%%
%% End of file `CASthesis.cls'.
